use clap::Parser;

use crate::translator::Translator;

#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
struct Args {
    #[arg(short, long, default_value_t = false)]
    /// auto append bootstrap code in the head.
    not_append_bootstrap: bool,
    /// the path of virtual machine file or A folder containing multiple VM files
    vm_file: String,
}

pub fn run() {
    let args = Args::parse();
    println!("> The virtual machine file : {}", args.vm_file);
    match Translator::translate(&args.vm_file, !args.not_append_bootstrap) {
        Ok(output_file) => println!("< Output assembly file: {}", output_file),
        Err(e) => eprintln!("Error: {}", e),
    }
}
